package com.jiyongjun.bms.tool.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * description: 业务异常
 *
 * @author yongjun.ji
 * @date 2019/2/27 16:48
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class BizException extends RuntimeException {
    private String code;
    private Object[] args;

    public BizException(String msg) {
        super(msg);
    }

    public BizException(String code, String msg) {
        super(code + ": " + msg);
        this.code = code;
    }

    public BizException(String msg, Throwable cause) {
        super(msg, cause);
    }

    public BizException(String code, String msg, Throwable cause) {
        super(code + ": " + msg, cause);
        this.code = code;
    }

    public BizException(String code, Object[] args, String msg) {
        super(code + ": " + msg);
        this.code = code;
        this.args = args;
    }

    public BizException(String code, Object[] args, String msg, Throwable cause) {
        super(code + ": " + msg, cause);
        this.code = code;
        this.args = args;
    }

    public BizException(Throwable cause) {
        super(cause);
    }

}
